export function getTodayAndSixDaysAgoDate() {

    const currentDate = new Date();
    const year = currentDate.getFullYear();
    const month = String(currentDate.getMonth() + 1).padStart(2, '0');
    const day = String(currentDate.getDate()).padStart(2, '0');
    const formattedCurrentDate = `${year}-${month}-${day}`;

    const sixDaysAgo = new Date();
    sixDaysAgo.setDate(currentDate.getDate() - 6);
    const sixDaysAgoYear = sixDaysAgo.getFullYear();
    const sixDaysAgoMonth = String(sixDaysAgo.getMonth() + 1).padStart(2, '0');
    const sixDaysAgoDay = String(sixDaysAgo.getDate()).padStart(2, '0');
    const formattedSixDaysAgo = `${sixDaysAgoYear}-${sixDaysAgoMonth}-${sixDaysAgoDay}`;

    return {
        dateTime: [formattedSixDaysAgo,formattedCurrentDate],
        dateTimeWithOutYear: [`${sixDaysAgoMonth}-${sixDaysAgoDay}`,`${month}-${day}`]
    }

}

export function countDecimalPlaces(num) {
    if (Math.floor(num) === num)
      return 0;
    const str = num.toString();
    const decimalPlaces = str.indexOf('.') === -1 ? 0 : str.length - str.indexOf('.') - 1;
    return decimalPlaces;
  }

